package cn.jhs.config.security.plugins;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.Collections;

/**
 * @author Trump
 * @desc
 * @date 2019/5/7 14:22
 */
public class SimpleUserDetails implements UserDetails {
    private String mobile;

    private String loginAcct;
    private String username;
    private String password;

    public SimpleUserDetails(String loginAcct, String password, String username, String mobile) {
        this.loginAcct = loginAcct;
        this.password = password;
        this.username = username;
        this.mobile = mobile;
    }

    @JsonIgnore
    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return Collections.emptyList();
    }

    @JsonIgnore
    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @JsonIgnore
    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @JsonIgnore
    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @JsonIgnore
    @Override
    public boolean isEnabled() {
        return true;
    }

    @JsonIgnore
    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public String getUsername() {
        return username;
    }

    public String getMobile() {
        return mobile;
    }


    public String getLoginAcct() {
        return loginAcct;
    }

}
